/*
 * @Author: Lin Hongwei
 * @Date: 2022-09-19 13:07:08
 * @LastEditTime: 2022-09-19 13:15:04
 * @LastEditors: Lin Hongwei
 * @email: 1365755396@qq.com
 * @CSDN: https://blog.csdn.net/weixin_45429409
 * @Description: 收藏组件
 */

import { Rate } from "antd";
import { ComponentProps } from "react";

interface PinProps extends Omit<ComponentProps<typeof Rate>, "onChange"> {
  checked: boolean;
  onChange?: (checked: boolean) => void;
}
export const Pin = ({ checked, onChange, ...props }: PinProps) => {
  return (
    <Rate
      count={1}
      value={checked ? 1 : 0}
      onChange={(num) => onChange?.(!!num)}
      {...props}
    />
  );
};
